/**
 * 
 */
package org.rollinitiative.d20.entity;

import javax.xml.bind.annotation.*;
import javax.xml.namespace.QName;


/**
 * @author jmccormi
 *
 */
@XmlRootElement(name = "Template", namespace = "java:org.rollinitiative.d20.entity")
@XmlType(name = "TemplateType", namespace = "java:org.rollinitiative.d20.entity")
public class NonPlayerTemplate extends Actor
{

   @XmlTransient
   private int instanceCount = 0;
   
   float challengeRating = 0;
   
   QName id = new QName("NOT SET");

   /**
    * @return the challengeRating
    */
   public float getChallengeRating()
   {
      return challengeRating;
   }

   /**
    * @param challengeRating the challengeRating to set
    */
   @XmlAttribute(required = true)
   public void setChallengeRating(float challengeRating)
   {
      this.challengeRating = challengeRating;
   }

   /**
    * @return the id
    */
   public QName getId()
   {
      return id;
   }

   /**
    * @param id the id to set
    */
   @XmlAttribute(required = true)
   public void setId(QName id)
   {
      this.id = id;
   }
   
   NonPlayer newInstance()
   {
      instanceCount++;
      NonPlayer npc = new NonPlayer(this.getName() + "-" + instanceCount);
      npc.baseScores = this.baseScores;
      npc.setRaceID(this.getRaceID());
      npc.alignment = this.alignment;
      npc.description = this.description;
      npc.setCharacterLevels(this.characterLevels);
      
      return npc;
   }
    
}
